﻿CREATE TABLE [dbo].[UserProfile] (
    [ID]                  UNIQUEIDENTIFIER DEFAULT (newid()) NOT NULL,
    [UserName]            NVARCHAR (16)    NOT NULL,
    [FullName]            NVARCHAR (32)    DEFAULT ('') NOT NULL,
    [Email]               NVARCHAR (64)    DEFAULT ('@') NOT NULL,
    [Password]            NVARCHAR (32)    DEFAULT ('') NOT NULL,
    [Root]                BIT              DEFAULT ((0)) NOT NULL,
    [LastChangedPassword] DATETIME         NULL,
    [LastLoginTime]       DATETIME         NULL,
    [LastLogoutTime]      DATETIME         NULL,
    [LastModifiedTime]    DATETIME         NULL,
    [LastModifiedUserId]  UNIQUEIDENTIFIER NULL,
    PRIMARY KEY CLUSTERED ([ID] ASC),
    CONSTRAINT [FK9F779D1211E65B0E] FOREIGN KEY ([LastModifiedUserId]) REFERENCES [dbo].[UserProfile] ([ID]),
    UNIQUE NONCLUSTERED ([UserName] ASC)
);

